package com.gt.quality.base.pojo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author makeJava
 * checkbox 联动问题是因为实体没有id字段，建议添加id字段
 * <p>   实体中加入 @TableField(exist = false)
 *     private String id;
 *     然后 Controller重写extendAfterByQueryLimit方法
 *         protected Object extendAfterByQueryLimit(BaseLimitResponse<SysFileInfo> data) {
 *         List<SysFileInfo> responseBody = data.getResponseBody();
 *         if (CollUtil.isNotEmpty(responseBody)) {
 *             for (SysFileInfo sysFileInfo : responseBody) {
 *                 sysFileInfo.setId(sysFileInfo.getFileId().toString());
 *             }
 *             data.setResponseBody(responseBody);
 *         }
 *         return super.extendAfterByQueryLimit(data);
 *     }</p>
 */
@Data
public class CommonTableInfo implements Serializable {

    /**
     * Description:  租户编号
     */
    @Schema(title = "tenant_id", description = "租户编号")
    @TableField(value = "tenant_id", fill = FieldFill.INSERT)
    protected String tenantId;

    /**
     * Description:  创建部门
     */
    @Schema(title = "create_dept", description = "创建部门")
    @TableField(value = "create_dept", fill = FieldFill.INSERT)
    protected Long createDept;

    /**
     * Description:  创建者
     */
    @Schema(title = "create_by", description = "创建者")
    @TableField(value = "create_by", fill = FieldFill.INSERT)
    protected Long createBy;

    /**
     * Description:  创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @Schema(title = "create_time", description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected LocalDateTime createTime;

    /**
     * Description:  更新者
     */
    @Schema(title = "update_by", description = "更新者")
    @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE)
    protected Long updateBy;

    /**
     * Description:  更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @Schema(title = "update_time", description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected LocalDateTime updateTime;

    @TableField(value = "del_flag")
    @Schema(title = "del_flag", description = "删除标志（1代表存在 0代表删除）")
    @TableLogic(delval = "0", value = "1")
    protected boolean delFlag;
}
